/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package helper;

import beansbinding.ComboBeanBindingArea;
import beansbinding.ComboBeanBindingTbClasificacionAccion;
import beansbinding.ComboBeanBindingTbTipoAccion;
import delegate.GestionDelegate;
import java.util.List;
import javax.swing.JComboBox;
import org.jdesktop.beansbinding.BindingGroup;

/**
 *
 * @author Vanessa
 */
public class Utiles_Combo {

    public Utiles_Combo() {
    }

    
    public void cargaComboArea( ComboBeanBindingArea comboBeanBindingArea1,BindingGroup bindingGroup, JComboBox cmbArea ){
        List listTbArea = null; // seteamos variable local
        List listaArea = comboBeanBindingArea1.getLista();
        listaArea.clear();
        try {
            listTbArea = GestionDelegate.getInstance().getListaArea();
        } catch (Exception e) {
            System.out.println( "Error en gestionDelegate.getListaArea()" );
            return;
        }
        comboBeanBindingArea1.setLista(listTbArea);
        bindingGroup.bind();
        cmbArea.updateUI();
    }

    public void cargaComboTipoAccion(ComboBeanBindingTbTipoAccion comboBeanBindingTbTipoAccion1, BindingGroup bindingGroup, JComboBox cmbTipoAccion ){
        List listTbTipoAccion = null; // seteamos variable local
        List listaTipoAccion =  comboBeanBindingTbTipoAccion1.getLista();
        listaTipoAccion.clear();
        try {
            listTbTipoAccion =  GestionDelegate.getInstance().getListaTbTipoAccion();
            comboBeanBindingTbTipoAccion1.setLista(listTbTipoAccion);
            bindingGroup.bind();
            cmbTipoAccion.updateUI();
        } catch (Exception e) {
            System.out.println( "Error en cargaComboTipoAccion() " + e.getMessage() );
            return;
        }
    }

    public void cargaComboTbClasificacionAccion( ComboBeanBindingTbClasificacionAccion comboBeanBindingTbClasificacionAccion1,BindingGroup bindingGroup, JComboBox cmbClasificacionAccion ){
        List listTbClasificacionAccion = null; // seteamos variable local
        List listClasificacionAccion =  comboBeanBindingTbClasificacionAccion1.getLista();
        listClasificacionAccion.clear();
        try {
            listTbClasificacionAccion =  GestionDelegate.getInstance().getListaTbClasificacionAccion();
            comboBeanBindingTbClasificacionAccion1.setLista(listTbClasificacionAccion);
            bindingGroup.bind();
            cmbClasificacionAccion.updateUI();
        } catch (Exception e) {
            System.out.println( "Error en cargaComboTbClasificacionAccion() " + e.getMessage() );
            return;
        }
    }

}
